﻿<Window x:Class="Netfraction.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Netfraction"
    Title="MainWindow" Height="600" Width="850" WindowStyle="SingleBorderWindow" AllowsTransparency="False" Closing="Window_Closing" StateChanged="Window_StateChanged">
    <Window.Resources>
        <local:UserToStatusImageConverter x:Key="UserToStatusImageConverter"/>
        <local:BytesConverter x:Key="BytesConverter"/>
    </Window.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" MinWidth="5" />
            <ColumnDefinition Width="230" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" MinHeight="5" />
            <RowDefinition Height="75" />
            <RowDefinition Height="75" />
        </Grid.RowDefinitions>
        <GridSplitter Grid.Column="1" Grid.RowSpan="3"
              HorizontalAlignment="Center"
              VerticalAlignment="Stretch"
              ShowsPreview="True"
              Width="5"
              />
        <GridSplitter Grid.Row="1" 
              HorizontalAlignment="Stretch"
              VerticalAlignment="Center"
              ShowsPreview="True"
              Height="5"
              />
        <RichTextBox Margin="0" Name="chatTextBox" Grid.Column="0" Grid.Row="0" VerticalScrollBarVisibility="Auto" IsReadOnly="True" IsDocumentEnabled="True">
            <RichTextBox.ContextMenu>
                <ContextMenu>
                    <MenuItem Name="SettingsMenuItem" Header="Settings" Click="SettingMenuItem_Click" />
                </ContextMenu>
            </RichTextBox.ContextMenu>
            <FlowDocument>
                <Paragraph>
                    <Paragraph.Inlines>
                        <InlineUIContainer>
                            <Image Source="file:///E:/testemo.png" Height="19" Width="19" Stretch="None" />
                        </InlineUIContainer>
                    </Paragraph.Inlines>
                </Paragraph>
            </FlowDocument>
        </RichTextBox>
        <RichTextBox Height="75" Name="messageTextBox" VerticalAlignment="Bottom" AcceptsTab="False" AcceptsReturn="False" Grid.Column="0" Grid.Row="2"/>
        <ListView Margin="0" Name="userListView" Grid.Column="2" Grid.RowSpan="3" ContextMenuOpening="usersContextMenu_ContextMenuOpening" VirtualizingStackPanel.IsVirtualizing="True">
            <ListView.View>
                <GridView>
                    <GridViewColumn Width="125" Header="Nick">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate DataType="Identity">
                                <StackPanel Orientation="Horizontal">
                                    <Image Width="16" Height="16" Stretch="Fill" Source="{Binding Converter={StaticResource UserToStatusImageConverter}}" />
                                    <TextBlock Text="{Binding Path=Nickname}" />
                                </StackPanel>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Width="75" Header="Shared" DisplayMemberBinding="{Binding Path=ShareSize, Converter={StaticResource BytesConverter}}" />
                    <!--<GridViewColumn Width="75" Header="Shared">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate DataType="Identity">
                                 <TextBlock Text="{Binding Path=ShareSize, Converter={StaticResource BytesConverter}}" TextAlignment="Right"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>-->
                </GridView>
            </ListView.View>
            <ListView.ContextMenu>
                <ContextMenu Name="usersContextMenu" StaysOpen="False">
                    <MenuItem Name="getFileListMenuItem" Header="Get File List" Click="GetFileListMenuItem_Click"/>
                    <MenuItem Name="sendPrivateMessageMenuItem" Header="Send Private Message" Click="SendPrivateMessageMenuItem_Click"/>
                </ContextMenu>
            </ListView.ContextMenu>
        </ListView>
        <!--<ListView Margin="0" Name="connectionsListView" Grid.ColumnSpan="3" Grid.Row="3" >
            <ListView.View>
                <GridView>
                    <GridViewColumn Width="125" Header="File Name">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate DataType="DCSharp.Backend.Managers.Downloader">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Path=Progress}" />
                                </StackPanel>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Width="75" Header="Status" />
                </GridView>
            </ListView.View>
        </ListView>-->
    </Grid>
</Window>
